﻿Imports System.Web
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Services
Imports System.Web.Script.Services
Imports System.Web.Services.Protocols
Imports VSModel
Imports System.Data.Objects
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Converters

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class swCheckData
    Inherits System.Web.Services.WebService

    <WebMethod()> _
 <ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
    Public Function CheckName(ByVal strName As String) As String
        Using _data As New VSEntities
            If strName.Trim <> "" Then
                Dim p = (From q In _data.Users Where q.UserName = strName Select q).FirstOrDefault
                If Not p Is Nothing Then
                    Return "0"
                Else
                    Return "1"
                End If
            Else
                Return "1"
            End If
        End Using
    End Function

    

    <WebMethod(EnableSession:=True)> _
    <ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
    Public Function IncreaseLogin() As String
        Context.Session("LastLogin") = Now
        Return "1"
    End Function

End Class